.class public Lorg/microemu/android/device/AndroidFont;
.super Ljava/lang/Object;
.source "AndroidFont.java"

# interfaces
.implements Lorg/microemu/device/impl/Font;


# instance fields
.field paint:Landroid/graphics/Paint;


# direct methods
.method public constructor <init>(Landroid/graphics/Typeface;IZ)V
    .locals 2
    .parameter "typeface"
    .parameter "size"
    .parameter "underlined"

    .prologue
    .line 38
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 36
    new-instance v0, Landroid/graphics/Paint;

    const/4 v1, 0x1

    invoke-direct {v0, v1}, Landroid/graphics/Paint;-><init>(I)V

    iput-object v0, p0, Lorg/microemu/android/device/AndroidFont;->paint:Landroid/graphics/Paint;

    .line 39
    iget-object v0, p0, Lorg/microemu/android/device/AndroidFont;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p1}, Landroid/graphics/Paint;->setTypeface(Landroid/graphics/Typeface;)Landroid/graphics/Typeface;

    .line 40
    iget-object v0, p0, Lorg/microemu/android/device/AndroidFont;->paint:Landroid/graphics/Paint;

    int-to-float v1, p2

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 41
    iget-object v0, p0, Lorg/microemu/android/device/AndroidFont;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p3}, Landroid/graphics/Paint;->setUnderlineText(Z)V

    .line 42
    return-void
.end method


# virtual methods
.method public charWidth(C)I
    .locals 4
    .parameter "ch"

    .prologue
    const/4 v3, 0x1

    const/4 v2, 0x0

    .line 45
    iget-object v0, p0, Lorg/microemu/android/device/AndroidFont;->paint:Landroid/graphics/Paint;

    new-array v1, v3, [C

    aput-char p1, v1, v2

    invoke-virtual {v0, v1, v2, v3}, Landroid/graphics/Paint;->measureText([CII)F

    move-result v0

    float-to-int v0, v0

    return v0
.end method

.method public charsWidth([CII)I
    .locals 1
    .parameter "ch"
    .parameter "offset"
    .parameter "length"

    .prologue
    .line 49
    iget-object v0, p0, Lorg/microemu/android/device/AndroidFont;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p1, p2, p3}, Landroid/graphics/Paint;->measureText([CII)F

    move-result v0

    float-to-int v0, v0

    return v0
.end method

.method public getBaselinePosition()I
    .locals 1

    .prologue
    .line 53
    iget-object v0, p0, Lorg/microemu/android/device/AndroidFont;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0}, Landroid/graphics/Paint;->getFontMetricsInt()Landroid/graphics/Paint$FontMetricsInt;

    move-result-object v0

    iget v0, v0, Landroid/graphics/Paint$FontMetricsInt;->ascent:I

    neg-int v0, v0

    return v0
.end method

.method public getHeight()I
    .locals 2

    .prologue
    .line 57
    iget-object v0, p0, Lorg/microemu/android/device/AndroidFont;->paint:Landroid/graphics/Paint;

    iget-object v1, p0, Lorg/microemu/android/device/AndroidFont;->paint:Landroid/graphics/Paint;

    invoke-virtual {v1}, Landroid/graphics/Paint;->getFontMetricsInt()Landroid/graphics/Paint$FontMetricsInt;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->getFontMetricsInt(Landroid/graphics/Paint$FontMetricsInt;)I

    move-result v0

    return v0
.end method

.method public stringWidth(Ljava/lang/String;)I
    .locals 1
    .parameter "str"

    .prologue
    .line 61
    iget-object v0, p0, Lorg/microemu/android/device/AndroidFont;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p1}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v0

    float-to-int v0, v0

    return v0
.end method
